package com.pucong.gitee.database.backup.business.unRelational.redis.controller;

import com.pucong.gitee.database.backup.business.unRelational.redis.service.AutoRedisService;
import com.pucong.gitee.database.backup.common.entity.redis.ConfigBean;
import com.pucong.gitee.database.backup.utils.Res;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/auto/redis/config")
@Api(value = "redis-API ", tags = "redis API")
public class ConfController {

    @Autowired
    private AutoRedisService autoRedisService;

    @GetMapping("/getConfInfo/{id}")
    @ApiOperation(value = "获取配置信息")
    public Res<List<ConfigBean>> getConfInfo(@ApiParam("主键")@PathVariable("id") String id) {
        return Res.ok(autoRedisService.getConfInfo(id));
    }

    @PostMapping("/setConfInfo/{id}")
    @ApiOperation(value = "设置配置信息")
    public void setConfInfo(@ApiParam("主键")@PathVariable("id") String id,List<ConfigBean> configBeanList) {
         autoRedisService.setConfInfo(id ,configBeanList);
    }

}
